{extend name='admin@main'}

{block name="button"}
<!-- 
{if auth("add")}
<button data-modal='{:url("add")}?type=add' data-title="添加部门" class='layui-btn layui-btn-sm layui-btn-primary'>添加部门</button>
{/if}

{if auth("remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些部门吗？" action="{:url('department/remove')}" class='layui-btn layui-btn-sm layui-btn-primary'>删除企业部门</button>
{/if} -->

{/block}

{block name="content"}

{php}
{//var_dump($list);}
{/php}
<div class="think-box-shadow">
    {include file='department/index_search'}
    <table class="layui-table" id="dept-table" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox nowrap'>
                <label>全选<input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='text-left nowrap' lay-data="{field:'id'}">
               序号
            </th>
			<th class='text-left nowrap' lay-data="{field:'dept_name'}">部门名称</th>
            {if $userinfo['db1']['authorize'] ==1 }
            <th class='text-left nowrap' lay-data="{field:'name'}">所属公司</th>
            {/if}
            <!-- <th class='text-left nowrap' lay-data="{field:'status'}">使用状态</th> -->
            <th class='text-left nowrap' lay-data="{field:'createtime'}">添加时间</th>
            <th class='text-left nowrap'>操作选项</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>

        {foreach $list as $key=>$vo}
		
		
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                 {if $vo.is_security!=1}
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
                {/if}
            </td>
            <td class='list-table-sort-td'>
                <label>{$vo.id}</label>
            </td>
			<td class='text-left nowrap'>{$vo.dept_name|default='-'}</td>
            {if $userinfo['db1']['authorize'] ==1 }
                <td class='text-left nowrap'>{$vo.name|default='-'}</td>	
            {/if}
<!--             <td class='text-left nowrap'>
                {eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{/eq}
                {eq name='vo.status' value='1'}<span class="color-green">已启用</span>{/eq}

            </td> -->
            <td class='text-left nowrap'>
                {$vo.createtime|format_datetime}
            </td>
            <td class='text-left nowrap'>

                {if auth("edit")}
                     {if $vo.is_security == 1}
                <button type="button" data-modal='{:url("company/user/add")}?dept_id={$vo.id}&is_m=5' data-title="设置部门经理" class='layui-btn layui-btn-normal layui-btn-sm'>设置经理</button>
                {else}
                  <button type="button" data-modal='{:url("company/user/add")}?dept_id={$vo.id}&is_m=3' data-title="设置部门经理" class='layui-btn layui-btn-normal layui-btn-sm'>设置经理</button>
                {/if}

                {if auth("details")}
                    <button type="button" data-open="{:url('company/user/index')}?dep_id={$vo.id}&spm=m-57-58-59" data-title="设置部门人员" class='layui-btn layui-btn-normal layui-btn-sm'>加入员工</button>

                {/if}
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑部门信息" data-modal='{:url("edit")}?id={$vo.id}&companyid={$vo.companyid}&type="edit"'>编 辑</a>


                {/if}

                {if auth("details")}
               <!--  <a data-dbclick class="layui-btn layui-btn-sm" data-title="部门内部信息" data-modal='{:url("details")}?id={$vo.id}&type="edit"'>详 情</a> -->
                {/if}
                {if auth("remove")}
                    {if $vo.is_security!=1}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该部门吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}" action="{:url('department/remove')}">删 除</a>
                    {/if}
                {/if}



            </td>
        </tr>
		
        {/foreach}

        </tbody>
    </table>
    <fieldset>
        <legend>操作选项</legend>
        {if auth("remove")}

            <div class="layui-inline padding-right-20">
              <label><input style="width: 18px;height: 18px" class="think-checkbox" data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </div>

            <button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些部门吗？" action="{:url('department/remove')}" class='layui-btn layui-btn-danger layui-btn-sm'>删 除</button>
<!-- 
            <button data-modal='{:url("add")}?type=add' data-title="添加部门" class='layui-btn layui-btn-sm layui-btn-normal'>添加部门</button> -->
        {/if}

         <button type="button" data-reload class="layui-btn layui-btn-sm">刷 新</button>
    </fieldset>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>

{/block}
